/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.market.web.model;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ps
 */
@Entity
@Table(name = "tempshoppingcart")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tempshoppingcart.findAll", query = "SELECT t FROM Tempshoppingcart t"),
    @NamedQuery(name = "Tempshoppingcart.findByCustID", query = "SELECT t FROM Tempshoppingcart t WHERE t.tempshoppingcartPK.custID = :custID"),
    @NamedQuery(name = "Tempshoppingcart.findByPid", query = "SELECT t FROM Tempshoppingcart t WHERE t.tempshoppingcartPK.pid = :pid"),
    @NamedQuery(name = "Tempshoppingcart.findByName", query = "SELECT t FROM Tempshoppingcart t WHERE t.name = :name"),
    @NamedQuery(name = "Tempshoppingcart.findByPrice", query = "SELECT t FROM Tempshoppingcart t WHERE t.price = :price"),
    @NamedQuery(name = "Tempshoppingcart.findByItemQty", query = "SELECT t FROM Tempshoppingcart t WHERE t.itemQty = :itemQty")})
public class Tempshoppingcart implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TempshoppingcartPK tempshoppingcartPK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "Name")
    private String name;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "Price")
    private BigDecimal price;
    @Basic(optional = false)
    @NotNull
    @Column(name = "itemQty")
    private int itemQty;

    public Tempshoppingcart() {
    }

    public Tempshoppingcart(TempshoppingcartPK tempshoppingcartPK) {
        this.tempshoppingcartPK = tempshoppingcartPK;
    }

    public Tempshoppingcart(TempshoppingcartPK tempshoppingcartPK, String name, BigDecimal price, int itemQty) {
        this.tempshoppingcartPK = tempshoppingcartPK;
        this.name = name;
        this.price = price;
        this.itemQty = itemQty;
    }

    public Tempshoppingcart(int custID, int pid) {
        this.tempshoppingcartPK = new TempshoppingcartPK(custID, pid);
    }

    public TempshoppingcartPK getTempshoppingcartPK() {
        return tempshoppingcartPK;
    }

    public void setTempshoppingcartPK(TempshoppingcartPK tempshoppingcartPK) {
        this.tempshoppingcartPK = tempshoppingcartPK;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public int getItemQty() {
        return itemQty;
    }

    public void setItemQty(int itemQty) {
        this.itemQty = itemQty;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tempshoppingcartPK != null ? tempshoppingcartPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tempshoppingcart)) {
            return false;
        }
        Tempshoppingcart other = (Tempshoppingcart) object;
        if ((this.tempshoppingcartPK == null && other.tempshoppingcartPK != null) || (this.tempshoppingcartPK != null && !this.tempshoppingcartPK.equals(other.tempshoppingcartPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.market.web.model.Tempshoppingcart[ tempshoppingcartPK=" + tempshoppingcartPK + " ]";
    }
    
}
